package com.dyzx.hbb.security.filter;

import com.dyzx.hbb.common.base.Result;
import com.dyzx.hbb.common.utils.ServletUtils;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * 退出登录处理器
 */
@Component
public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler {
    
    @Override
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) 
            throws IOException, ServletException {
        ServletUtils.renderString(response, Result.ok("退出成功"));
    }
}
